package net.cyue.android.js;


import android.webkit.JavascriptInterface;

import com.kongzue.dialogx.dialogs.MessageDialog;
import com.kongzue.dialogx.dialogs.PopTip;
import com.kongzue.dialogx.dialogs.TipDialog;
import com.kongzue.dialogx.dialogs.WaitDialog;

public class DialogXJSInterface
{

    @JavascriptInterface
    public void wait(String message) {
        WaitDialog.show(message);
    }

    @JavascriptInterface
    public void popup(String message)
    {
        PopTip.show(message);
    }


    @JavascriptInterface
    public void tip(String message, String type)
    {
        WaitDialog.TYPE t = WaitDialog.TYPE.WARNING;
        if (type.equals("success") || type.equals("SUCCESS"))
            t = WaitDialog.TYPE.SUCCESS;
        else if (type.equals("error") || type.equals("ERROR"))
            t = WaitDialog.TYPE.ERROR;
        TipDialog.show(message, t);
    }

    @JavascriptInterface
    public void tipSuccess(String message) {
        TipDialog.show(message, WaitDialog.TYPE.SUCCESS);
    }
    @JavascriptInterface
    public void tipError(String message) {
        TipDialog.show(message, WaitDialog.TYPE.ERROR);
    }
    @JavascriptInterface
    public void tipWarning(String message) {
        TipDialog.show(message, WaitDialog.TYPE.WARNING);
    }


    @JavascriptInterface
    public void message(String title, String message)
    {
        MessageDialog.show(title, message);
    }


}


